<?php
//希乐排序
function shellSort(&$array,$d){
    for($i=$d;$i<count($array);$i++){
        $j=$i;
        $number=$array[$j];
        while($j-$d>=0&&$array[$j-$d]>$number){
            $array[$j]=$array[$j-$d];
            $j=$j-$d;
        }
        $array[$j]=$number;
    }
}



$array=array(3,5,8,6,4,0,7,9,1,2);
$darray=array(5,3,1);
foreach($darray as $d){
    shellSort($array,$d);
}
print_r($array);

?>